﻿@using App.Web.Utility;
@using App.Core.DB;
@{
    String pageTitle = "Utility";
    ViewBag.Title = Html.GetPageTitle(pageTitle);

    int _TotalFailedEmails = ViewData[AppConstants.ViewDataKeys.SUB_MODEL] == null ? 0 : NullHandler.GetInt(ViewData[AppConstants.ViewDataKeys.SUB_MODEL]);
}

<div class="page-heading">
    <h1>@pageTitle</h1>
    <div>
        List of matched product(s) for your given search key.
    </div>
</div>

<div class="GroupBox">
    <div id="divFailedEmailMessage" style="margin-bottom:10px;">Total @_TotalFailedEmails were not sent due to some error.</div>
    <input type="button" onclick="SendFailedEmail()" value="Send Failed Emails" />
</div>

<script type="text/javascript" language="javascript">
    function SendFailedEmail() {
        ShowLoadingAnimation(false);
        Ajax('/admin/utility/sendfailedemail', null, function (result) {
            HideLoadingAnimation();
            var info = eval('(' + result + ')');
            $('#divFailedEmailMessage').html(info.SuccussMessage);
            $('#divFailedEmailMessage').append(info.ErrorMessage);
        });
    }   
</script>

